#include "qpresslabel.h"
#include <QDebug>

QPressLabel::QPressLabel(QWidget *parent):QLabel(parent)
{

}

void QPressLabel::mousePressEvent(QMouseEvent *event)
{
    qDebug()<<purpose;
    if(purpose == close_window)//根据用途来产生消息（调用消息函数）
    {
        this->closeWindow();
        qDebug()<<"close window";
    }
    else if(purpose == set_image)
    {
        this->setImage();
        qDebug()<<"set image";
    }
}

void QPressLabel::setPurpose(PURPOSE purpose)
{
    this->purpose = purpose;

}
